//
//  DiscountCell.m
//  WhereToTravel
//
//  Created by dlios on 15/10/15.
//  Copyright © 2015年 zhoushengmin. All rights reserved.
//

#import "DiscountCell.h"
#define W self.contentView.frame.size.width/375
#define H self.contentView.frame.size.height/100

@implementation DiscountCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatView];
    }
    return self;
}
- (void)creatView {
    [super createView];
    self.leftImage = [[UIImageView alloc]init];
    [self.contentView addSubview:self.leftImage];
    self.topLabel.font = [UIFont boldSystemFontOfSize:13];
    self.leftLabel.font = [UIFont systemFontOfSize:12];
    self.rightLabel.font = [UIFont systemFontOfSize:12];
    self.numberLabel.font = [UIFont systemFontOfSize:18];
    self.leftLabel.textColor = [UIColor redColor];
    self.rightLabel.textColor = [UIColor redColor];
    self.numberLabel.textColor = [UIColor redColor];
    self.numberLabel.textAlignment = NSTextAlignmentRight;
    self.topLabel.textAlignment = NSTextAlignmentLeft;
    self.topLabel.numberOfLines = 0;
    
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.leftImage.frame = CGRectMake(W*10, H*10, W*100, W*80);
    self.topLabel.frame = CGRectMake(W*115, 0, W*250, H*50);
    self.leftLabel.frame = CGRectMake(W*115, H*70, W*50, H*30);
    self.rightLabel.frame = CGRectMake(W*340, H*70, W*40, H*30);
    self.numberLabel.frame = CGRectMake(W*280, H*70, W*60, H*30);
  
    [self.leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(10 * W);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.27);
        make.top.equalTo(self.contentView).offset(10 * H);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.8);
    }];
    [self.topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImage.mas_right).offset(5 * W);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.67);
        make.top.equalTo(self.contentView);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.5);
    }];
    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImage.mas_right).offset(5 * W);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.14);
        make.bottom.equalTo(self.contentView);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.3);
    }];
    [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.mas_right).offset(-5 * W);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.11);
        make.bottom.equalTo(self.contentView);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.3);
    }];
    [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.rightLabel.mas_left);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.16);
        make.bottom.equalTo(self.contentView);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.3);
    }];
}
@end
